#include <fstream>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

#define max_N 100
int result = 0;
int N = 4;

int get_number(int n,int m){
    if (m==0)
        return 1;
    return n * get_number(n - 1, m - 1);
}
int get_result(vector<int> xy_data)
{
    int n = xy_data.size();
    int temp_result = 0;
    for (int i = 0; i < n;++i){
        int c = get_number(n-1, i)/get_number(i,i);
        temp_result += xy_data[i] * c;
    }
    return temp_result;
}
int main()
{
#ifndef ONLINE_JUDGE 
    fstream cin("test.txt");
#endif
    vector<int> result_data;
    while(cin >> N>>result){
        vector<int> xy_data;
        for (int i = 0; i < N;++i)
            xy_data.push_back(i + 1);
        do
        {
            if (result == get_result(xy_data)){
                result_data = xy_data;
                break;
            }
        } while (next_permutation(xy_data.begin(), xy_data.end()));
        for (int i = 0; i < result_data.size();++i){
            cout << result_data[i] << " ";
        }
        cout << endl;
    }
    return 0;
}